#coding:utf-8
from Tkinter import *
root = Tk()
root.withdraw()    #hide window
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight() - 100    #under windows, taskbar may lie under the screen
root.resizable(False,False)

#add some widgets to the root window...

root.update_idletasks()
root.deiconify()    #now window size was calculated
root.withdraw()     #hide window again
root.geometry('%sx%s+%s+%s' % (root.winfo_width() + 10, root.winfo_height() + 10, (screen_width - root.winfo_width())/2, (screen_height - root.winfo_height())/2) )    #center window on desktop
root.deiconify()

Label(root, text="用户名").grid(row=0)
Label(root, text="密码").grid(row=1)

e1 = Entry(root)
e2 = Entry(root)

e1.grid(row=0, column=1)
e2.grid(row=1, column=1)

root.mainloop()
